package com.china08.yxyapi.api.manage.tec.teaching.mistakes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.entity.mg.lecture.YxyLectureCatalog;
import com.china08.yxyapi.model.YxyApiReqModel;
import com.china08.yxyapi.repository.mg.lecture.YxyLectureCatalogRepository;

/**
 * 教师中心任教书籍删除
 * 
 * @author Administrator
 *
 */
@CrossOrigin
@RestController
public class YxyMistakesCatalogDelController extends YxyApiBaseController {

    @Autowired
    private YxyLectureCatalogRepository yxyLectureCatalogRepository;

    @RequestMapping(value = "/api_yw/manage/tec/teaching/mistakes/mistakescatalog/del", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public void process(HttpServletRequest request, HttpServletResponse response, @RequestBody ReqModel model) {
        YxyLectureCatalog yxyLectureCatalog = yxyLectureCatalogRepository.findOne(model.id);
        Assert.notNull(yxyLectureCatalog, "改册别不存在");
        yxyLectureCatalogRepository.delete(yxyLectureCatalog);
    }

    /**
     * 请求参数
     * 
     */
    protected static class ReqModel extends YxyApiReqModel {
        // 册别id
        public String id;
    }

}
